﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace BudgetPanoramaApplication.Framework
{
    public static class CollectionExtension
    {
        /// <summary>
        /// Add a collection to the current observable collection
        /// </summary>
        /// <typeparam name="T">data type</typeparam>
        /// <param name="oc">current collection</param>
        /// <param name="collection">new data</param>
        public static void AddRange<T>(this ObservableCollection<T> oc, IEnumerable<T> collection)
        {
            if (null == collection)
            {
                throw new ArgumentNullException("collection");
            }

            foreach (var item in collection)
            {
                oc.Add(item);
            }
        }
    }
}
